package com.basic;

import com.frame.struts.BaseBean;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import com.utils.CommUtil;
import javax.servlet.http.HttpServletResponse;
import com.frame.struts.ActionContext;
import javax.servlet.ServletException;


/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class MainSaleCommodityForm extends BaseBean {
    public MainSaleCommodityForm() {
    }

	MainSaleCommodityEntity msc = new MainSaleCommodityEntity();

		public String addMainSaleCommodity() {
			HttpServletRequest request = ActionContext.getActionContext().
				getRequest();
			HttpServletResponse response = ActionContext.getActionContext().
				getResponse();
			BasicFactory factory = new BasicFactory();
			String qyid = (String) request.getSession().getAttribute("session_qyid");
			msc.setQyid(qyid);
			msc.setOptdate(new Date());
			msc.setOptrid(CommUtil.getUserId(request));
			try{
			if(factory.addMainSaleCommodity(msc)){
				//System.out.println("wo zhi xing le!");
					response.sendRedirect("/basic/queryMainSaleCommodity.jsp");
					return "success";
			}
			response.sendRedirect("/basic/failed.jsp");
		   }
		   catch (Exception e) {

		   }
		   return "11";
		}

		public String modifyMainSaleCommodity(){
				HttpServletRequest request = ActionContext.getActionContext().
					getRequest();
				HttpServletResponse response = ActionContext.getActionContext().
					getResponse();
				BasicFactory factory = new BasicFactory();
				String qyid = (String) request.getSession().getAttribute("session_qyid");
				msc.setQyid(qyid);
				msc.setOptdate(new Date());
				msc.setOptrid(CommUtil.getUserId(request));
				//factory.deleteMainSaleCommodity(msc.getSpid());
				try{
				if(factory.modifyMainSaleCommodity(msc)){
					//System.out.println("wo zhi xing le!");
						response.sendRedirect("/basic/queryMainSaleCommodity.jsp");
						return "success";
				}
				response.sendRedirect("/basic/failed.jsp");
				}
				catch (Exception e) {

				}

					return "11";
			}

			public String getOldId() {
				return this.getOldId();
			}
			/**
			 * @param chd The chd to set.
			 */
			public void setOldId(String oldId) {
				this.setOldId(oldId);
			}


			public String getChd() {
				return msc.getChd();
			}
			/**
			 * @param chd The chd to set.
			 */
			public void setChd(String chd) {
				msc.setChd(chd);
			}
			/**
			 * @return msc. return msc.s the dx.
			 */
			public String getDx() {
				return msc.getDx();
			}
			/**
			 * @param dx The dx to set.
			 */
			public void setDx(String dx) {
				msc.setDx(dx);
			}
			/**
			 * @return msc. return msc.s the jhqd.
			 */
			public String getJhqd() {
				return msc.getJhqd();
			}
			/**
			 * @param jhqd The jhqd to set.
			 */
			public void setJhqd(String jhqd) {
				msc.setJhqd(jhqd);
			}
			/**
			 * @return msc. return msc.s the ls.
			 */
			public String getLs() {
				return msc.getLs();
			}
			/**
			 * @param ls The ls to set.
			 */
			public void setLs(String ls) {
				msc.setLs(ls);
			}
			/**
			 * @return msc. return msc.s the mlr.
			 */
			public double getMlr() {
				return msc.getMlr();
			}
			/**
			 * @param mlr The mlr to set.
			 */
			public void setMlr(double mlr) {
				msc.setMlr(mlr);
			}
			/**
			 * @return msc. return msc.s the nxl.
			 */
			public String getNxl() {
				return msc.getNxl();
			}
			/**
			 * @param nxl The nxl to set.
			 */
			public void setNxl(String nxl) {
				msc.setNxl(nxl);
			}
			/**
			 * @return msc. return msc.s the ny.
			 */
			public String getNy() {
				return msc.getNy();
			}
			/**
			 * @param ny The ny to set.
			 */
			public void setNy(String ny) {
				msc.setNy(ny);
			}
			/**
			 * @return msc. return msc.s the optdate.
			 */
			public Date getOptdate() {
				return msc.getOptdate();
			}
			/**
			 * @param optdate The optdate to set.
			 */
			public void setOptdate(Date optdate) {
				msc.setOptdate(optdate);
			}
			/**
			 * @return msc. return msc.s the optrid.
			 */
			public String getOptrid() {
				return msc.getOptrid();
			}
			/**
			 * @param optrid The optrid to set.
			 */
			public void setOptrid(String optrid) {
				msc.setOptrid(optrid);
			}
			/**
			 * @return msc. return msc.s the pf.
			 */
			public String getPf() {
				return msc.getPf();
			}
			/**
			 * @param pf The pf to set.
			 */
			public void setPf(String pf) {
				msc.setPf(pf);
			}
			/**
			 * @return msc. return msc.s the qyid.
			 */
			public String getQyid() {
				return msc.getQyid();
			}
			/**
			 * @param qyid The qyid to set.
			 */
			public void setQyid(String qyid) {
				msc.setQyid(qyid);
			}
			/**
			 * @return msc. return msc.s the recstate.
			 */
			public String getRecstate() {
				return msc.getRecstate();
			}
			/**
			 * @param recstate The recstate to set.
			 */
			public void setRecstate(String recstate) {
				msc.setRecstate(recstate);
			}
			/**
			 * @return msc. return msc.s the remark.
			 */
			public String getRemark() {
				return msc.getRemark();
			}
			/**
			 * @param remark The remark to set.
			 */
			public void setRemark(String remark) {
				msc.setRemark(remark);
			}
		/**
		 * @return msc. return msc.s the spid.
		 */
		public int getSpid() {
			return msc.getSpid();
		}
		/**
		 * @param spid The spid to set.
		 */
		public void setSpid(int spid) {
			msc.setSpid(spid);
		}
			/**
			 * @return msc. return msc.s the splb.
			 */
			public String getSplb() {
				return msc.getSplb();
			}
			/**
			 * @param splb The splb to set.
			 */
			public void setSplb(String splb) {
				msc.setSplb(splb);
			}
			/**
			 * @return msc. return msc.s the xse.
			 */
			public double getXse() {
				return msc.getXse();
			}
			/**
			 * @param xse The xse to set.
			 */
			public void setXse(double xse) {
				msc.setXse(xse);
			}

}